package com.geostar.gmp.snmp;

import java.util.List;

import org.dom4j.Element;
import org.snmp4j.PDU;

import com.geostar.gmp.global.ConfigValue;
import com.geostar.gmp.utils.ReadXMLUtils;
/**
 * 文件名:GetStatus.java
 * 功能:
 * 目前支持方法
 * --------------------------------------
 * 初始版本 
 * 作者: yesong
 * 时间: Apr 4, 2014
 */
public class GetStatus extends AbstractGetStatus{

	private PDU reponse;
	public String getCpu() {
		int sum = 0;
		this.reponse = getStatus("cpu");
		if(this.reponse != null){
			for (int i = 0; i < this.reponse.size(); i++) {
				sum += Integer.parseInt(this.reponse.get(i).getVariable().toString());
			}
		}
		return String.valueOf(sum / this.reponse.size());
	}

	public String getDisk() {
		// TODO Auto-generated method stub
		return null;
	}

	public String getNetStatus() {
		// TODO Auto-generated method stub
		return null;
	}

	public String getOther(String oid) {
		// TODO Auto-generated method stub
		return null;
	}

	public String getRom() {
		// TODO Auto-generated method stub
		return null;
	}

	public PDU getReponse() {
		return reponse;
	}

	public void setReponse(PDU reponse) {
		this.reponse = reponse;
	}
	
	public static void main(String[] args) {
		ReadXMLUtils.loadXML(ConfigValue.MIBCONFIG_XML);
		Element e = ReadXMLUtils.readElementsById("127.0.0.1");
		Element cpu1 = e.elementByID("cpu");
		List<Element> oidElements = cpu1.elements("oid");
		for (Element element : oidElements) {
			String ee = element.getTextTrim();
		}
	}
}
